<template>
  <div class="block">
    <el-backtop></el-backtop>
    <el-row>
      <el-col :xs="4" :sm="4" :md="4" :lg="4" :xl="4">
        <div class="grid-content bg-purple">
          <el-link href="https://element.eleme.io" target="_blank" :underline="false" class="mybutton">贾豆|豆品</el-link>
        </div>
      </el-col>
      <el-col :xs="16" :sm="16" :md="16" :lg="16" :xl="16">
        <div class="grid-content bg-purple-light">
          <el-link href="https://element.eleme.io" target="_blank" :underline="false" class="titlebutton">全部商品</el-link>&nbsp;&nbsp;
          <el-link type="primary" class="titlebutton" :underline="false">豆瓣经典</el-link>&nbsp;&nbsp;
          <el-link type="success" class="titlebutton" :underline="false">家居生活</el-link>&nbsp;&nbsp;
          <el-link type="warning" class="titlebutton" :underline="false">外出旅行</el-link>&nbsp;&nbsp;
          <el-link type="info" class="titlebutton" :underline="false">文具小物</el-link>
        </div>
      </el-col>
      <el-col :xs="4" :sm="4" :md="4" :lg="4" :xl="4">
        <div class="grid-content bg-purple-light">
          <el-link type="info" class="usercenter" :underline="false">个人中心</el-link>
          <el-avatar src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"
                     class="imagehead"></el-avatar>
        </div>
      </el-col>
    </el-row>
    <el-carousel trigger="click" height="500px">
      <el-carousel-item v-for="(item,index) in imgs" :key="index">
        <!--<h3 class="small">{{ item }}</h3>-->
        <img class="carousel-img" :src="item.url">
      </el-carousel-item>
    </el-carousel>
    <br>
    <h1>新品首发</h1>
    <el-row>
      <el-col :span="9" v-for="(item, index) in cardList" :key="index" :offset="2">
        <el-card :body-style="{ padding: '2px'}" @click.native="openArticle(item.proname,item.price)"
                 style="margin:12px">
          <img :src="item.img"
               class="image">
          <div style="padding: 24px;float:left;text-align: left;font-size: 22px;line-height: 1.5">
            <span>{{item.proname}}</span><br>
            <span>{{item.desc}}</span><br>
            <span style="color: red">¥:{{item.price}}</span><br>
          </div>
        </el-card>
      </el-col>
    </el-row>
    <h1>人气单品</h1><br><br>
    <el-row style="margin-right: 130px;margin-left: 130px">
      <el-col :span="6" v-for="(item, index) in list" :key="index" :offset="0">
        <el-card :body-style="{ padding: '2px'}" @click.native="openArticle('123')"
                 style="margin-left: 20px;margin-right: 20px">
          <img :src="item.img"
               class="imagehot">
          <div style="padding: 20px;float:left;text-align: left;font-size: 22px;line-height: 1.5">
            <span>{{item.proname}}</span><br>
            <span>{{item.desc}}</span><br>
            <span style="color: red">¥:{{item.price}}</span><br>
          </div>
        </el-card>
      </el-col>
    </el-row>
    <!-- 分页插件-->
    <el-pagination
      background
      :page-size="this.params.size"
      :current-page="this.params.page"
      v-on:current-change="changePage"
      layout="prev, pager, next"
      :total="total">
    </el-pagination>
    <!-- <el-pagination
       layout="prev,pager,next"
       :page-size="this.params.size"
       v-on:current-change="changePage"
       :total="total" :current-page="this.params.page" style="float:right;">
     </el-pagination>-->
    <el-row>
      <el-col :span="12">
        <h1 style="text-align: left;margin-left: 150px">豆瓣经典<span
          style="font-size: 20px;margin-left: 20px">口碑好物，匠心甄选</span></h1>
      </el-col>
      <el-col :span="12">
        <el-link
          style="float:right;text-align: right;font-size: 22px;line-height: 1.5;margin-top: 40px;margin-right: 170px">
          查看更多>
        </el-link>
      </el-col>
    </el-row>
    <el-row style="margin-right: 130px;margin-left: 130px">
      <el-col :span="6" v-for="(item, index) in cardList" :key="index" :offset="0">
        <el-card :body-style="{ padding: '2px'}" @click.native="openArticle('123')"
                 style="margin-left: 20px;margin-right: 20px">
          <img :src="item.img"
               class="imagehot">
          <div style="padding: 20px;float:left;text-align: left;font-size: 22px;line-height: 1.5">
            <span>{{item.proname}}</span><br>
            <span>{{item.desc}}</span><br>
            <span style="color: red">¥:{{item.price}}</span><br>
          </div>
        </el-card>
      </el-col>
    </el-row>


    <el-row>
      <el-col :span="12">
        <h1 style="text-align: left;margin-left: 150px">家居生活<span
          style="font-size: 20px;margin-left: 20px">追求品质，乐享生活</span></h1>
      </el-col>
      <el-col :span="12">
        <el-link
          style="float:right;text-align: right;font-size: 22px;line-height: 1.5;margin-top: 40px;margin-right: 170px">
          查看更多>
        </el-link>
      </el-col>
    </el-row>
    <el-row style="margin-right: 130px;margin-left: 130px">
      <el-col :span="6" v-for="(item, index) in cardList" :key="index" :offset="0">
        <el-card :body-style="{ padding: '2px'}" @click.native="openArticle('123')"
                 style="margin-left: 20px;margin-right: 20px">
          <img :src="item.img"
               class="imagehot">
          <div style="padding: 20px;float:left;text-align: left;font-size: 22px;line-height: 1.5">
            <span>{{item.proname}}</span><br>
            <span>{{item.desc}}</span><br>
            <span style="color: red">¥:{{item.price}}</span><br>
          </div>
        </el-card>
      </el-col>
    </el-row>


    <el-row>
      <el-col :span="12">
        <h1 style="text-align: left;margin-left: 150px">外出旅行<span
          style="font-size: 20px;margin-left: 20px">实用贴心，探索世界</span></h1>
      </el-col>
      <el-col :span="12">
        <el-link
          style="float:right;text-align: right;font-size: 22px;line-height: 1.5;margin-top: 40px;margin-right: 170px">
          查看更多>
        </el-link>
      </el-col>
    </el-row>
    <el-row style="margin-right: 130px;margin-left: 130px">
      <el-col :span="6" v-for="(item, index) in cardList" :key="index" :offset="0">
        <el-card :body-style="{ padding: '2px'}" @click.native="openArticle('123')"
                 style="margin-left: 20px;margin-right: 20px">
          <img :src="item.img"
               class="imagehot">
          <div style="padding: 20px;float:left;text-align: left;font-size: 22px;line-height: 1.5">
            <span>{{item.proname}}</span><br>
            <span>{{item.desc}}</span><br>
            <span style="color: red">¥:{{item.price}}</span><br>
          </div>
        </el-card>
      </el-col>
    </el-row>


    <el-row>
      <el-col :span="12">
        <h1 style="text-align: left;margin-left: 150px">文具小物<span
          style="font-size: 20px;margin-left: 20px">点滴思绪，自在书写</span></h1>
      </el-col>
      <el-col :span="12">
        <el-link
          style="float:right;text-align: right;font-size: 22px;line-height: 1.5;margin-top: 40px;margin-right: 170px">
          查看更多>
        </el-link>
      </el-col>
    </el-row>
    <el-row style="margin-right: 130px;margin-left: 130px">
      <el-col :span="6" v-for="(item, index) in cardList" :key="index" :offset="0">
        <el-card :body-style="{ padding: '2px'}" @click.native="openArticle('123')"
                 style="margin-left: 20px;margin-right: 20px">
          <img :src="item.img"
               class="imagehot">
          <div style="padding: 20px;float:left;text-align: left;font-size: 22px;line-height: 1.5">
            <span>{{item.proname}}</span><br>
            <span>{{item.desc}}</span><br>
            <span style="color: red">¥:{{item.price}}</span><br>
          </div>
        </el-card>
      </el-col>
    </el-row>

    <div style="background-color: lightgray;padding-bottom: 40px">
      <el-row style="font-size: 22px;line-height: 20px;margin-left: 140px;margin-top: 100px;padding-top: 50px;">
        <el-col :xs="14" :sm="14" :md="14" :lg="14" :xl="14">
          <div class="grid-content bg-purple-light" style="text-align: left;margin-left: 30px">
            <el-link href="https://element.eleme.io" target="_blank" :underline="false" class="titlebutton">贾豆|豆品
            </el-link>&nbsp;&nbsp;
          </div>
        </el-col>
        <el-col :xs="10" :sm="10" :md="10" :lg="10" :xl="10">
          <div class="grid-content bg-purple-light" style="text-align: right;margin-right: 30px;">
            <i class="el-icon-question"></i>&nbsp;<el-link type="info" class="usercenter2" :underline="false">购物说明
          </el-link>&nbsp;&nbsp;
            <i class="el-icon-edit"></i>&nbsp;<el-link type="info" class="usercenter2" :underline="false">意见反馈</el-link>&nbsp;&nbsp;
            <i class="el-icon-chat-dot-square"></i>&nbsp;<el-link type="info" class="usercenter2" :underline="false">
            商务合作
          </el-link>&nbsp;&nbsp;
          </div>
        </el-col>
      </el-row>
      <h3>© 2020 market.douban.com, all rights reserved 豆品文化有限公司</h3>
      <h3>食品经营许可证: JY11105111524423</h3>
      <h3>出版物经营许可证：新出发京批字第直170330号</h3>
      <br><br>
    </div>

  </div>
</template>

<script>
  import axios from 'axios'

  export default {
    name: '',
    data() {
      return {
        pageData: [],
        total: 50,
        params: {
          page: 1,
          size: 4
        },
        list: [],
        currentDate: new Date(),
        imgs: [
          {url: require('../assets/img/banner1.jpg'), link: '/content1'},
          {url: require('../assets/img/banner2.jpg'), link: '/content2'},
          {url: require('../assets/img/banner3.jpg'), link: '/content3'},
          {url: require('../assets/img/banner4.jpg'), link: '/content3'}
        ],
        hotList: [],
        cardList: [{
          img: 'http://qapthkpg0.bkt.clouddn.com/1.jpg',
          proname: '产品名产品名产品名产品名产品名产品名产品名产品名产品名1',
          desc: '产品描述1',
          price: 11111
        }, {
          img: 'http://qapthkpg0.bkt.clouddn.com/1.jpg',
          proname: '产品名产品名产品名产品名产品名产品名产品名产品名产品名2',
          desc: '产品描述2',
          price: 2323
        }, {
          img: 'http://qapthkpg0.bkt.clouddn.com/1.jpg',
          proname: '产品名产品名产品名产品名产品名产品名产品名产品名产品名3',
          desc: '产品描述3',
          price: 343
        }, {
          img: 'http://qapthkpg0.bkt.clouddn.com/1.jpg',
          proname: '产品名产品名产品名产品名产品名产品名产品名产品名产品名3',
          desc: '产品描述4',
          price: 567
        }]
      }
    },
    methods: {
      linkTo() {
        let activeIndex = this.$refs.carousel.activeIndex
        this.$router.push(this.imgs[activeIndex].link)
      },
      openArticle: function (proname, price) {
        this.$router.push('/item/' + proname + '/' + price)
      }, changePage: function (page) {
        this.params.page = page;
        this.query()
      }, query: function () {

        var url = 'bean/bean/findByPage/' + this.params.page + '/' + this.params.size;
        var _this = this;
        axios.get(url).then(res => {
          console.log(res)
          _this.total = res.data.total;
          _this.list = res.data.list;
        }, res => {
          this.confirm("查询失败")
        })
      }
    }, created: function () {
      var _this = this;
      axios.get('/bean/bean/hot').then(function (res) {
        _this.cardList = res.data;
      });
      this.query();
    }
  }
</script>
<style>
  .mybutton {
    font-size: 37px;
    color: #44883e;
  }

  .mybutton:hover {
    color: #42b983;
  }

  .titlebutton {
    text-align: right;
    font-size: 27px;
    color: chartreuse;
  }

  .imagehead {
    margin-right: 15px;
    float: right;
    font-size: 17px;
    color: chartreuse;
  }

  .usercenter {
    margin-top: 4px;
    float: right;
    font-size: 17px;
    color: chartreuse;
    line-height: 37px;
  }

  .el-carousel__item h3 {
    color: #475669;
    font-size: 14px;
    opacity: 0.75;
    line-height: 150px;
    margin: 0;
  }

  .el-carousel__item:nth-child(2n) {
    background-color: #99a9bf;
  }

  .el-carousel__item:nth-child(2n+1) {
    background-color: #d3dce6;
  }

  a:link {
    color: #06F;
    text-decoration: none;
  }

  /* 未访问的链接 */
  a:visited {
    color: #999;
    text-decoration: line-through;
  }

    /* 已访问的链接 */
  a:hover {
    color: #F00;
    text-decoration: underline;
  }

  /* 鼠标移动到链接上 */
  a:active {
    color: #F0F;
  }

  /* 选定的链接 */
  .time {
    font-size: 13px;
    color: #999;
  }

  .bottom {
    margin-top: 13px;
    line-height: 12px;
  }

  .button {
    padding: 0;
    float: right;
  }

  .image {
    width: 100%;
    display: block;
  }

  .imagehot {
    height: 320px;
    width: 100%;
    display: block;
  }

  .clearfix:before,
  .clearfix:after {
    display: table;
    content: "";
  }

  .clearfix:after {
    clear: both
  }

  .el-col {
    border-radius: 4px;
  }

  .bg-purple-dark {
    /*background: #99a9bf;*/
  }

  .bg-purple {
    /*background: #d3dce6;*/
    padding-top: 4px;
  }

  .bg-purple-light {
    /*background: #e5e9f2;*/
    padding-right: 70px;
    padding-top: 16px;
  }

  .grid-content {
    border-radius: 4px;
    min-height: 66px;
  }

  .el-row {
    margin-bottom: 20px;

  &
  :last-child {
    margin-bottom: 0;
  }

  }
  .el-col {
    border-radius: 4px;
  }

  .bg-purple-dark {
    /*background: #99a9bf;*/
  }

  .bg-purple {
    /*background: #d3dce6;*/
  }

  .bg-purple-light {
    /*background: #e5e9f2;*/
  }

  .grid-content {
    border-radius: 4px;
    min-height: 36px;
  }

  .row-bg {
    padding: 10px 0;
    /*background-color: #f9fafc;*/
  }
</style>

